// import { useModel } from '@umijs/max';
import React, {useEffect, useState} from 'react';

import TwoRowLayout from "@/components/TwoRowLayout";
import { useParams, useLocation, history } from '@umijs/max';
const Welcome: React.FC = () => {

  //const { initialState } = useModel('@@initialState');

  const { sessionId } = useParams<{ sessionId: string }>();
  const location = useLocation();

  useEffect(() => {
    if (location.state?.prompt) {
      setPrompt(location.state?.prompt);
      history.replace({
        ...location,
        state: {}, // 替换State为空对象
      });
      if (prompt) {
        //TODO shunyun 2025/3/28: state should be cleared after being processed
      } else {
        //query history message
      }
    }
  }, [sessionId]);

  return (
     <TwoRowLayout prompt={prompt}></TwoRowLayout>
  );
};

export default Welcome;
